import { Component, OnInit } from '@angular/core';
import {Router} from '@angular/router';

@Component({
  selector: 'app-left-side-bar',
  templateUrl: './left-side-bar.component.html',
  styleUrls: ['./left-side-bar.component.css']
})
export class LeftSideBarComponent implements OnInit {
  private menus: Menu[];
  private currentId: number;

  constructor(private router: Router) { }

  ngOnInit() {
    this.menus = [
      new Menu(1, '学生管理页面', '/studentManager'),
      new Menu(2, '测试页面01', '/test01')
    ];
  }

  nav(menu: Menu) {
    this.router.navigateByUrl(menu.url);
    this.currentId = menu.id;
  }

}

export class Menu {
  constructor(
    public id: number,
    public name: string,
    public url: string
  ) {}
}
